package com.atguigu.obs;

import com.obs.services.ObsClient;

import java.awt.*;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;

public class ObsTest {

    public static void main(String[] args) throws IOException {
        String endPoint = "https://obs.cn-north-1.myhuaweicloud.com";
        String ak = "Y527D5IEWXKFU2I4GCJG";
        String sk = "EgiZNKyEzKsQvWsPRC3Tw6rIBx2HsvpWjbIyriKv";
        // 创建ObsClient实例
        ObsClient obsClient = new ObsClient(ak, sk, endPoint);

        // 使用访问OBS
//        创建桶名称
//        obsClient.createBucket("bucketname-yjh-test-lll");

//
        obsClient.putObject("bucket-test-yjh", "objectname", new File("C:\\Users\\ASUS\\Desktop\\总结\\经典语录.txt"));


        // 关闭obsClient，全局使用一个ObsClient客户端的情况下，不建议主动关闭ObsClient客户端
        obsClient.close();


    }




}
